// // Copyright (c) 2020 Presto Labs Pte. Ltd.
// // Author: donggu

// #include "coin2/flow/reader.h"

// #include <gtest/gtest.h>

// #include "coin2/exchange/base/executor/topic_publisher.h"
// #include "coin2/feed/archive/system.h"
// #include "orio/record/topic.h"

// const size_t BUF_SIZE = 100 * 1024;

// TEST(Flow, GetFileList) {
//   auto day1 = 1578585600000000000LL;   // 20200110:000000
//   auto day2 = 1578672000000000000LL;   // 20200111:000000
//   auto day3 = 1578758400000000000LL;   // 20200112:000000

//   auto files1 =
//       coin2::flow::FlowReader::GetFileList("feed-01.ap-northeast-1.aws",
//                                            "/remote/iosg/coin/data/flow",
//                                            day1, day2);
//   EXPECT_EQ(files1.size(), 1135);

//   auto files2 =
//       coin2::flow::FlowReader::GetFileList("feed-01.ap-northeast-1.aws",
//                                            "/remote/iosg/coin/data/flow",
//                                            day2, day3);
//   EXPECT_EQ(files2.size(), 1134);

//   auto files3 =
//       coin2::flow::FlowReader::GetFileList("feed-01.ap-northeast-1.aws",
//                                            "/remote/iosg/coin/data/flow",
//                                            day1, day3);
//   EXPECT_EQ(files3.size(), files1.size() + files2.size());                             // 2139
// }

// TEST(Flow, FlowReader) {
//   auto reader = std::unique_ptr<coin2::flow::FlowReader>(new coin2::flow::FlowReader(
//       "feed-01.ap-northeast-1.aws", "/remote/iosg/coin/data/flow",
//       {"upbit_ws_trade_b4", "okex_ws_topic_event", "bithumb_ws_trade_g2"},
//       1569974400102000000LL,  // start
//       1569977400140000000LL, BUF_SIZE));
//   auto buf = std::make_unique<char[]>(BUF_SIZE);

//   int n = 0;
//   auto* r = reinterpret_cast<coin2::exchange::base::executor::TopicRecordPacket*>(buf.get());
//   while (reader->Read(r)) {
//     n++;
//   }
//   CHECK_EQ(n, 419);
// }
